package ycl.common.base.entity;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;


import java.io.Serializable;
import java.util.Map;

/**
 * 实体类基类
 *
 * @author YCL
 * @date 2021-06-04 23:59:23
 */
@Data
@Accessors(chain = true)
public class BaseEntity implements Serializable {

	
	private static final long serialVersionUID = -8280048470677145868L;

	@TableId(type = IdType.AUTO)
	private Long id;

	@TableField(exist = false)
	@Schema(description = "元数据")
	private Map<String, Object> meta;

	@TableField(exist = false)
	private int current = 1;

	@TableField(exist = false)
	private int size = 10;

	public Map<String, Object> getParams() {
		if (CollUtil.isEmpty(meta))
			meta = Maps.newHashMap();
		return meta;
	}
}
